#pragma once

#include "Base/AbstractRemoteProcedure.h"
#include <QObject>
#include "Network/Connection.h"
#include "../Data/User.h"

namespace TC
{
    namespace Request
    {
        class TCCORE_EXPORT MultiPostSubmitter : public AbstractRemoteProcedure
        {
            Q_OBJECT
        public:
            Q_INVOKABLE void newAudio(QString type, QString source, QString comment)
            {
                if (status() == Status::Communicating)
                    return;
                AbstractRemoteProcedure::get("evaluation/multi/new/audio",
                {
                    { "signature", Data::User::instance()->signature() },
                    { "type", type },
                    { "audioSource", source },
                    { "comment", comment },
                });
            }
            Q_INVOKABLE void newImage(QString type, uint imageCount, QString mainImage, QString comment)
            {
	            if (status() == Status::Communicating)
	                return;
                AbstractRemoteProcedure::get("evaluation/multi/new/image",
                {
                    { "signature", Data::User::instance()->signature() },
                    { "type", type },
                    { "imageCount", imageCount },
                    { "mainImage", mainImage },
                    { "comment", comment },
                });
            }
        protected:
            void onDataReady(QDataStream &stream) override
            {
	            bool result;
	            stream >> result;
	            if (result)
	            {
	                setOk();
	            }
	            else
                {
                    setFailed();
                }
            }
        private:
        };
    }
}